package com.hmall.search.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class EsConfig {

    @Bean
    public RestHighLevelClient restHighLevelClient(){
        return new RestHighLevelClient(RestClient.builder(HttpHost.create("http://192.168.179.100:9200")));
    }

    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
    /*@Bean
    public RestHighLevelClient restHighLevelClient(){
        return new RestHighLevelClient(
                // HttpHost: ES的一个节点
                RestClient.builder(new HttpHost("192.168.179.100", 9200,"http")));
    }*/
}
